package cn.yly.esearch.sql4es.http;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Properties;

public class EsHttpConfig {
	
	public static final String esType="0";
	
	private static  Map<String,List<EsConfig>> esConfig = new HashMap<String, List<EsConfig>>();
	
	public static synchronized List<EsConfig> getEsConfig(String idnex){
		if(esConfig.get(idnex)==null){
			//初始化esConfig
			//单节点测试，服务器为多节点
			 String jdbcUrl="jdbc:es://ip:9200/";
			 Properties props = new Properties();
			 props.put("username", "用户名");
			 props.put("password", "密码");
			 EsConfig mEsConfig = new EsConfig(jdbcUrl,props,idnex);
			 List<EsConfig> list = new ArrayList<>();
			 list.add(mEsConfig);
			 esConfig.put(idnex, list);
		}
		return esConfig.get(idnex);
	}

}
